import axios from '@/utils/myaxios.js'

//获取新闻内容
export const postlists = function (params) {
  // console.log('经过获取数据');
  return axios({
    url: '/post?',
    params
  })
}

//获取新闻详情
export const postarticaldetail = function (id) {
  // console.log('获取新闻详情-数据');
  return axios({
    url: '/post/' + id,

  })
}

//点赞文章
export const getuserlike = function (id) {
  // console.log('经过修改点赞数据');
  return axios({
    url: '/post_like/' + id,
  })
}
//收藏文章
export const getuserstar = function (id) {
  // console.log('经过获取收藏数据');
  return axios({
    url: '/post_star/' + id,
  })
}
//获取评论
export const postcomment = function (id) {
  // console.log('获取了文章评论');
  return axios({
    url: '/post_comment/' + id,
  })
}
//发表评论
export const topostcomments = function (id, data) {
  // console.log('发布了评论');
  return axios({
    method: 'post',
    url: '/post_comment/' + id,
    data
  })
}

//搜索
export const tosearch = function (key) {
  // console.log('进行搜索了');
  console.log(key);
  return axios({
    url: '/post_search?keyword=' + key,
  })
}



